<%-- 
    Document   : cadSuprimentos
    Created on : 11/03/2011, 15:36:13
    Author     : jonathas
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!-- Declaração das Tags da biblioteca RichFaces -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <style>.cols{
            vertical-align:top;

        }

    </style>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link href="../css/estilomodelo.css" rel="stylesheet" type="text/css" />

            <title>CADASTRO DE Funcionario | Sistema Gestão de Suprimentos - SGS</title>
        </head>
        <body>
            <div id="container">
                <div id="banner">
                </div><%--Banner--%>

                <div  id="conteudoCad">
                    <a4j:form>
                        <rich:tabPanel switchType="client" style="width:752px; height:200px; background-color:#EEEEEE;">
                            <rich:tab label="Dados Pessoais">
                                <f:facet name="header">
                                    <h:outputText value="Cadastro Funcionario"  ></h:outputText>
                                </f:facet>
                                <h:panelGrid cellpadding="4" columns="2">
                                    <h:panelGrid  columns="3">
                                        <h:outputText  value="Nome: "/>
                                        <rich:inplaceInput inputWidth="70" id="nome" value="#{ObjFacadeFuncionario.funcionario.pessoa.nome}" defaultLabel="Digite o nome" required="true" />
                                        <rich:message for="nome"/>

                                        <h:outputText value="RG: "/>
                                        <rich:inplaceInput inputWidth="70" id="rg" value="#{ObjFacadeFuncionario.funcionario.pessoa.rg}" defaultLabel="Digite o RG" required="true" />
                                        <rich:message for="rg"/>

                                        <h:outputText value="CPF: "/>
                                        <rich:inplaceInput inputWidth="70" id="cpf" value="#{ObjFacadeFuncionario.funcionario.pessoa.cpf}" defaultLabel="Digite o CPF" required="true" />
                                        <rich:message for="cpf"/>

                                        <h:outputText value="Rua: "/>
                                        <rich:inplaceInput inputWidth="70" id="rua" value="#{ObjFacadeFuncionario.funcionario.pessoa.rua}" defaultLabel="Digite a rua" required="true" />
                                        <rich:message for="rua"/>

                                        <h:outputText value="Numero: "/>
                                        <rich:inplaceInput id="numero" value="#{ObjFacadeFuncionario.funcionario.pessoa.numero}" defaultLabel="Digite o numero" required="true" />
                                        <rich:message for="numero"/>

                                        <h:outputText value="Bairro: "/>
                                        <rich:inplaceInput inputWidth="70" id="bairro" value="#{ObjFacadeFuncionario.funcionario.pessoa.bairro}" defaultLabel="Digite o bairro" required="true" />
                                        <rich:message for="bairro"/>
                                    </h:panelGrid>

                                    <h:panelGrid columns="3">
                                        <h:outputText value="CEP: "/>
                                        <rich:inplaceInput inputWidth="70" id="cep" value="#{ObjFacadeFuncionario.funcionario.pessoa.cep}" defaultLabel="Digite o cep" required="true" />
                                        <rich:message for="cep"/>

                                        <h:outputText value="Complemento: "/>
                                        <rich:inplaceInput inputWidth="70" id="complemento" value="#{ObjFacadeFuncionario.funcionario.pessoa.complemento}" defaultLabel="complemento" required="true" />
                                        <rich:message for="complemento"/>

                                        <h:outputText value="Cidade "/>
                                        <rich:inplaceInput inputWidth="70" id="cidade" value="#{ObjFacadeFuncionario.funcionario.pessoa.cidade}" defaultLabel="Digite o cidade" required="true" />
                                        <rich:message for="cidade"/>

                                        <h:outputText  value="UF: "/>
                                        <rich:comboBox id="uf"  defaultLabel="uf"  value="#{ObjFacadeFuncionario.funcionario.pessoa.uf}" required="true">
                                            <f:selectItems value="#{ObjDAO.ufs}"/>
                                        </rich:comboBox>
                                        <rich:message for="uf"/>

                                        <h:outputText value="Fone "/>
                                        <rich:inplaceInput inputWidth="70" id="fone" value="#{ObjFacadeFuncionario.funcionario.pessoa.fone}" defaultLabel="Digite o fone" required="true" />
                                        <rich:message for="fone"/>

                                        <h:outputText value="Email "/>
                                        <rich:inplaceInput inputWidth="70" id="email" value="#{ObjFacadeFuncionario.funcionario.pessoa.email}" defaultLabel="Digite o email" required="true" />
                                        <rich:message for="email"/>
                                    </h:panelGrid>


                                </h:panelGrid>
                            </rich:tab>

                            <rich:tab label="Dados Funcionario">
                                <h:panelGrid columns="3">
                                    <h:outputText  value="Obra: "/>
                                    <rich:comboBox id="obra"  defaultLabel="Obras"  value="#{ObjFacadeFuncionario.funcionario.obra}" converter="ConverterObraList" enableManualInput="false" required="true">
                                        <f:selectItems value="#{ObjDAO.obras}"/>
                                    </rich:comboBox>
                                    <rich:message for="obra"/>

                                    <h:outputText  value="Função: "/>
                                    <rich:comboBox id="funcao"  defaultLabel="Função"  value="#{ObjFacadeFuncionario.funcionario.cargo}" converter="ConverterCargoList" enableManualInput="false" required="true">
                                        <f:selectItems value="#{ObjDAO.cargos}"/>
                                    </rich:comboBox>
                                    <rich:message for="funcao"/>

                                    <h:outputText value="Admissão "/>
                                    <rich:calendar id="admissao" datePattern="dd/MM/yyyy" cellWidth="24px" cellHeight="22px" style="width: 200px" value="#{ObjFacadeFuncionario.funcionario.admissao}" />
                                    <rich:message for="admissao"/>

                                    <h:outputText value="CTPS "/>
                                    <rich:inplaceInput id="ctps" value="#{ObjFacadeFuncionario.funcionario.ctps}" defaultLabel="Digite o ctps" required="true" />
                                    <rich:message for="ctps"/>

                                    <h:outputText value="Serie "/>
                                    <rich:inplaceInput id="serie" value="#{ObjFacadeFuncionario.funcionario.serie}" defaultLabel="Digite a serie" required="true" />
                                    <rich:message for="serie"/>
                                    <a4j:commandButton value="Cadastro" action="#{ObjFacadeFuncionario.cadastrarFuncionario}" />

                                </h:panelGrid>
                            </rich:tab>
                        </rich:tabPanel>
                    </a4j:form>
                </div><%--Conteúdo--%>
                <div align="center" id="tableCad">
                    <h:form>
                        <rich:dataTable style="width:740px;" id="area" border="1" value="#{ObjDAO.allFuncionario}" rendered="#{not empty ObjDAO.allFuncionario}"  var="c" rows="4">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Id"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.idFuncionario}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Nome"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.nome}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="RG"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.rg}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="CPF"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.cpf}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="CEP"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.cep}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="bairro"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.bairro}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Rua"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.rua}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Cidade"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.cidade}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Numero"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.numero}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Comp."/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.complemento}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="UF"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.uf}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Contato"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.fone}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Email"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.pessoa.email}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="obra"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.obra}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Função"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.cargo}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Admissão"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.admissao}">
                                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                                    </h:outputText></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="CTPS"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.ctps}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Serie"/>
                                </f:facet>
                                <center> <h:outputText value="#{c.serie}"/></center>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Excluir"/>
                                </f:facet>
                                <center> <h:commandButton value="excluir" action="#{ObjFacadeFuncionario.excluirFuncionario}" image="../imagens/icon/excluir.gif" ></center>
                                    <f:setPropertyActionListener target="#{ObjFacadeFuncionario.funcionario}" value="#{c}"/>
                                </h:commandButton>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Alterar"/>
                                </f:facet>
                                <center> <h:commandButton value="alterar" action="editar" image="../imagens/icon/alterar.gif" ></center>
                                    <f:setPropertyActionListener target="#{ObjFacadeFuncionario.funcionario}" value="#{c}"/>
                                </h:commandButton>
                            </h:column>
                            <f:facet name="footer">
                                <rich:datascroller />
                            </f:facet>
                        </rich:dataTable>
                    </h:form>
                </div><%--Tabela--%>


                <div id="rodape">
                </div><%--Rodapé--%>
            </div><%--Container--%>
        </body>
    </html>

</f:view>
